Skip to main content

WhatsApp Single Message API

The WhatsApp Single Message API allows businesses to send pre-approved WhatsApp message templates to end users using their WhatsApp Business account. These APIs support customizable components like text, media, buttons, and dynamic parameters for personalized communication.


Prerequisites
  1. WhatsApp Business Account: Share the following details with the Msgkart team so they can send messages on your behalf:

    • BusinessId
    • PhoneNumberId
    • Template
  2. Msgkart Account: An active Msgkart account with API Key or Bearer Token authentication.


Request Syntax

POST /api/v3/message/{msgkartId}/template

Request Headers

x-api-key: <API KEY>
Content-Type: application/json

Request Body

{
"message": {
"messageType": "template",
"name": "msgkart_admin",
"language": "en_US",
"components": [
{
"componentType": "header",
"parameters": [
{
"type": "media",
"mediaId": "{{mediaUrl}}",
"mediaType": "image"
}
]
},
{
"componentType": "body",
"parameters": [
{
"type": "text",
"text": "{{text}}"
},
{
"type": "text",
"text": "Test value"
}
]
}
]
},
"to": "9999999999",
"phoneNumberId": "{{phoneNumberId}}"
}

Response Body

{
"transactionId": "7c9e8a12-4f6d-4b3e-9a21-0c9f87a6d312",
"messageId": "wamid.HBgMOTE5NjY4NDEyMDY4FQIAERgSREEwQkYxNjIxMTk5ODRDNddzAA=="
}

Properties

PropertyTypeRequiredDescription
message.messageTypestringYesType of message (e.g. "template").
message.namestringYesApproved WhatsApp template name.
message.languagestringYesLanguage code (e.g. "en_US").
message.componentsarrayYesArray of component objects (header, body, button).
tostringYesRecipient phone number (without leading +).
phoneNumberIdstringYesWhatsApp Business Phone Number ID.

Examples

Sample Request (cURL)

curl --location 'https://alb-backend.msgkart.com/api/v3/message/<BUSINESS ID>/template' \
--header 'x-api-key: <API KEY>' \
--header 'Content-Type: application/json' \
--data '{
"message": {
"messageType": "template",
"name": "msgkart_admin",
"language": "en_US",
"components": [
{
"componentType": "header",
"parameters": [
{
"type": "media",
"mediaId": "https://scontent.whatsapp.net/v/t61.29466-34/435061426_1113953846871534_7756253713572728880_n.png",
"mediaType": "image"
}
]
},
{
"componentType": "body",
"parameters": [
{
"type": "text",
"text": "Test value"
},
{
"type": "text",
"text": "Test value"
}
]
}
]
},
"to": "9994094528",
"phoneNumberId": "126875363728090"
}'